<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/6/19
  Time: 14:53
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>联系跟进</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layui/css/layui.css">
</head>
<body>
<form class="layui-form" action="${pageContext.request.contextPath}/linkman/track" method="post">
    <div>
        <button class="layui-btn" lay-filter="contact" lay-submit>新建跟踪记录</button>
    </div>
</form>
<table id="roleTable" class="layui-hide" lay-filter="roleTable"></table>
<script src="${pageContext.request.contextPath}/static/layui/layui.js"></script>
<script>
    layui.use(['layer','form','table','jquery'],function () {
        var layer = layui.layer
            , form = layui.form;
        var table = layui.table;
        var $ = layui.$;
        //表单提交监听事件
        form.on('submit(query)', function (data) {
            console.log(data.elem) //被执行事件的元素DOM对象，一般为button对象
            console.log(data.form) //被执行提交的form对象，一般在存在form标签时才会返回
            console.log(data.field) //当前容器的全部表单字段，名值对形式：{name: value}
            table.reload("roleTable", {
                where: {//查询条件
                    params: data.field// 会封装到LayRequest中的params中去
                },
                page: {
                    curr: 1//当前页
                }
            })
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
            table.on('toolbar(roleTable)', function(obj){
                //选中的数据
                var checkStatus = table.checkStatus(obj.config.id);
                switch(obj.event){
                case 'contact':
            layer.open({
                title:'新建跟踪',
                type: 2,
                content:"${pageContext.request.contextPath}/linkman/track",
                area:['600px','500px'],
                maxmin:true
            })
                };
        });
        });
    });
</script>
</body>
</html>
